From: Marina Zhurakhinskaya Date: Sun, 30 Jan 2011 23:33:49 +0000 (-0500) Subject: Make sure we only emit 'destroy' for a notification once X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~9163 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=7369ea61254ecf3de82a251a77eeb0b6ac57527e;p=gnome-shell.git Make sure we only emit 'destroy' for a notification once There are multiple code passes that can result in Notification::destroy() being called, such as a notification being closed by the application when it exits and the associated source being removed at the same time. However, we should only emit 'destroy' for the notification and do the associated work once. --- diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 81997df06..baa11f0d4 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -254,6 +254,7 @@ Notification.prototype = { // 'transient' is a reserved keyword in JS, so we have to use an alternate variable name this.isTransient = false; this.expanded = false; + this._destroyed = false; this._useActionIcons = false; this._customContent = false; this._bannerBodyText = null; @@ -771,6 +772,9 @@ Notification.prototype = { }, destroy: function(reason) { + if (this._destroyed) + return; + this._destroyed = true; if (!reason) reason = NotificationDestroyedReason.DISMISSED; this.emit('destroy', reason);